package com.jnshu.quartz;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

/**
 * @author xmp
 * @date 2019/8/12 23:19
 */
@Configuration
public class QuartzConfig {

    @Bean(name = "scheduler")
    public SchedulerFactoryBean schedulerFactory(){
        SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
        // 用于quartz集群,QuartzScheduler 启动时更新己存在的Job
        schedulerFactoryBean.setOverwriteExistingJobs(true);
        return schedulerFactoryBean;
    }

}
